<!DOCTYPE html>
<html>
    
    <head>
        <title>Forms</title>
        <!-- Bootstrap -->
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
        <link href="assets/styles.css" rel="stylesheet" media="screen">
        <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="vendors/flot/excanvas.min.js"></script><![endif]-->
        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
    </head>
    
    <body>
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="#">商铺管理</a>
                    <div class="nav-collapse collapse">
                        <ul class="nav pull-right">
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-user"></i> 设置 <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a tabindex="-1" href="binding.html">商铺信息设置</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a tabindex="-1" href="login.html">退出</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <ul class="nav">
                             <li class="active">
                                <a href="#" onclick="refresh();">商铺信息</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" data-toggle="dropdown" class="dropdown-toggle">设置 <b class="caret"></b>

                                </a>
                                <ul class="dropdown-menu" id="menu1">
                                    
                               
                                    <li>
                                        <a href="#" onclick="javascript:bingding();" >修改邮箱</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a href="#" onclick="javascript:updatePwd();">修改密码</a>
                                    </li>
                           
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Content <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a tabindex="-1" href="#">Blog</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">News</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Custom Pages</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Calendar</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a tabindex="-1" href="#">FAQ</a>
                                    </li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Users <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a tabindex="-1" href="#">User List</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Search</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Permissions</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <!--/.nav-collapse -->
                </div>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span3" id="sidebar">
                    <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                        <li>
                            <a href="index.html"><i class="icon-chevron-right"></i> 商品</a>
                        </li>
                        
                        <li>
                            <a href="binding.html"><i class="icon-chevron-right"></i> 设置</a>
                        </li>
                  
                        <li  class="active">
                             <a href="#" onclick="orderShow();"><i class="icon-chevron-right"></i>订单</a>
                        </li>
                       <li>
                            <a href="#"><span class="badge badge-success pull-right">812</span> Invoices</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">27</span> Clients</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">1,234</span> Users</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">2,221</span> Messages</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">11</span> Reports</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-important pull-right">83</span> Errors</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-warning pull-right">4,231</span> Logs</a>
                        </li>
                    </ul>
                </div>
                <!--/span-->
                <div class="span9" id="content">
                    
                    <div class="row-fluid">
                        <div class="alert alert-success">
							<button type="button" class="close" data-dismiss="alert">&times;</button>
                            <h4>您好！</h4>
                        	欢迎登录，商铺管理系统~~~</div>
                        	<div class="navbar">
                            	<div class="navbar-inner" id="dir">
	                                <ul class="breadcrumb">
	                                    <i class="icon-chevron-left hide-sidebar"><a href='#' title="Hide Sidebar" rel='tooltip'>&nbsp;</a></i>
	                                    <i class="icon-chevron-right show-sidebar" style="display:none;"><a href='#' title="Show Sidebar" rel='tooltip'>&nbsp;</a></i>
	                                    <li >
	                                        <a href="#" id="dir_first" onclick="refresh();">商铺管理</a> <span class="divider">/</span>	
	                                    </li>
	                                    <li >
	                                        <a href="#" onclick="javascript:setting();" id="dir_second">后台设置</a> <span class="divider">/</span>	
	                                    </li>
	                                    <li class="active" id="dir_third">修改邮箱</li>
	                                </ul>
                            	</div>
                        	</div>
                          <p hidden="hidden" id="myImg"><img src="images/mybg.jpg"></p>
                    	</div>
                   
                    <div id="mySetting">
                        <div class="alert alert-info alert-block">
										
										<h4 class="alert-heading" onclick="updatePwd()">修改密码</h4>
										初次登陆后请务必修改您的默认密码。修改完成后请妥善保管，切勿告知他人，如有泄露本网站不予负责。谢谢合作~~~
									</div>
                        
                        <div class="alert alert-info alert-block">
										
										<h4 class="alert-heading" onclick="bingding()">修改邮箱</h4>
										修改邮箱后，我们会发送邮件到您的邮箱，您还可以根据自己的邮箱登录本系统，感谢您对本系统的支持，祝您使用愉快！！！
									</div>
                    
                    </div>
                    <div id="myBinding" hidden="hidden">
                     <!-- validation -->
                    <div class="row-fluid">
                         <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">修改邮箱</div>
                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
					<!-- BEGIN FORM-->
					<form action="#" id="form_sample_1" class="form-horizontal">
						<fieldset>
							
							<div class="alert alert-success " id="a" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								正在发送邮件，请耐心等候...
							</div>
                            <div class="alert " id="b" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								绑定成功，请注意查收邮件！
							</div>
                            <div class="alert alert-error " id="c" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								网络出错，请检查网络是否可用！
							</div>
                            <div class="alert alert-error " id="d" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								填写错误，请仔细检查！
							</div>
  							<div class="control-group">
  								<label class="control-label">Email<span class="required">*</span></label>
  								<div class="controls">
  									<input name="email" id="admin_mail" type="text" class="span6 m-wrap"/>
                                    <span class="help-block">e.g: xxx@qq.com or xxx@163.com</span>
  								</div>
                            </div>
  							<div class="control-group">
  								<label class="control-label">新Email<span class="required">*</span></label>
  								<div class="controls">
  									<input name="newemail" id="newadmin_mail" type="text" class="span6 m-wrap"/>
                                    <span class="help-block">e.g: xxx@qq.com or xxx@163.com</span>
  								</div>
                            </div>
  							
  							<div class="control-group">
                                <label class="control-label">密码<span class="required">*</span></label>
  								<div class="controls">
  									<input name="password" id="admin_pwd" type="password" class="span6 m-wrap"/>
                                </div>
                            </div>
                            
  							<div class="control-group">
  								<label class="control-label">手机号<span class="required">*</span></label>
  								<div class="controls">
  									<input name="tele" id="admin_tel" type="text" class="span6 m-wrap"/>
                                    
  								</div>
  							</div>
  							
  							
  							<div class="form-actions">
  								<button type="submit" class="btn" id="mysubmit">提交</button>
  								<button type="reset" class="btn">重置</button>
  							</div>
                           
                            
						</fieldset>
					</form>
					<!-- END FORM-->
				</div>
			    </div>
			</div>
                     	<!-- /block -->
		    </div>
                     <!-- /validation -->
                    </div>
                    
                    
                    
                    <div class="row-fluid section" hidden="hidden">
                         <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">修改密码</div>
                            </div>
                            <div class="block-content collapse in">
                             
                                <div class="alert alert-success " id="aa" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								正在修改，请耐心等候...
							</div>
                            <div class="alert " id="bb" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								修改成功！
							</div>
                            <div class="alert alert-error " id="cc" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								网络出错，请检查网络是否可用！
							</div>
                            <div class="alert alert-error " id="dd" hidden="hidden">
								<button class="close" data-dismiss="alert"></button>
								填写错误，请仔细检查！
							</div>
                                <div class="span12">
                                    <div id="rootwizard">
                                        <div class="navbar">
                                          <div class="navbar-inner">
                                            <div class="container">
                                        <ul>
                                            <li><a href="#tab1" data-toggle="tab">输入账号密码</a></li>
                                            <li><a href="#tab2" data-toggle="tab">输入修改的密码</a></li>
                                            <li><a href="#tab3" data-toggle="tab">确认</a></li>
                                        </ul>
                                         </div>
                                          </div>
                                        </div>
                                        <div id="bar" class="progress progress-striped active">
                                          <div class="bar"></div>
                                        </div>
                                        
                                       
                                        <div class="tab-content">
                                            <div class="tab-pane" id="tab1">
                                              
                                                  <fieldset>
                                                    <div class="control-group">
                                                      <label class="control-label" for="focusedInput">邮箱</label>
                                                      <div class="controls">
                                                        <input class="input-xlarge focused" id="email" type="text" value="" name="email">
                                                      </div>
                                                    </div>
                                                    <div class="control-group">
                                                      <label class="control-label" for="focusedInput">密码</label>
                                                      <div class="controls">
                                                        <input class="input-xlarge focused" id="password" type="password" value="" name="password">
                                                      </div>
                                                    </div>
                                                    
                                                  </fieldset>
                                              
                                            </div>
                                            <div class="tab-pane" id="tab2">
                                               
                                                  <fieldset>
                                                    <div class="control-group">
                                                      <label class="control-label" for="focusedInput">新密码</label>
                                                      <div class="controls">
                                                        <input class="input-xlarge focused" id="newpassword1" type="password" value="" name="newpassword1">
                                                      </div>
                                                    </div>
                                                    <div class="control-group">
                                                      <label class="control-label" for="focusedInput">重新输入</label>
                                                      <div class="controls">
                                                        <input class="input-xlarge focused" id="newpassword2" type="password" value="" name="newpassword2">
                                                      </div>
                                                    </div>
                                                    
                                                  </fieldset>
                                               
                                            </div>
                                            <div class="tab-pane" id="tab3">
                                                
                                                 <div class="well" style="margin-top:30px;">
							                         <button class="btn btn-large btn-block btn-primary" id="myUpdate">提   交</button>
                                                     <button type="reset" class="btn btn-large btn-block">重置</button>
                                                </div>
                                             
                                            </div>
                                            <ul class="pager wizard">
                                                <li class="previous first" style="display:none;"><a href="javascript:void(0);">第一步</a></li>
                                                <li class="previous"><a href="javascript:void(0);">上一步</a></li>
                                                <li class="next last" style="display:none;"><a href="javascript:void(0);">最后一步</a></li>
                                                <li class="next"><a href="javascript:void(0);">下一步</a></li>
                                                <li class="next finish" style="display:none;"><a href="javascript:;">完成</a></li>
                                            </ul>
                                        </div>  
                                        
                                    </div>
                                </div>
                                
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
                    
	            <!-- /wizard -->
                     <div id="myOrderTable">
                    <div class="row-fluid">
                        <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">所有订单</div>
                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
                                   
                                    
                                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                                        <thead>
                                            <tr>
                                                <th>编号</th>
                                                <th>订购时间</th>
                                                <th>收货人</th>
                                                <th>总价</th>
                                                <th>商品编号</th>
                                                <th>收货地址</th>
                                            </tr>
                                        </thead>
                                        <tbody id="ordermain">
                                           
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
        
        </div>
                    
                </div>
            </div>
            <hr>
           <footer style="margin-bottom: 20px;">
                <p>&copy; 木小草  && 木蔷薇     </p><p>商家管理系统，采用JMS消息队列传输信息，Bootstrap前端框架，JQuery异步交互，完全独立的管理系统</p>
            </footer>
        </div>
        <!--/.fluid-container-->
        <link href="vendors/datepicker.css" rel="stylesheet" media="screen">
        <link href="vendors/uniform.default.css" rel="stylesheet" media="screen">
        <link href="vendors/chosen.min.css" rel="stylesheet" media="screen">

        <link href="vendors/wysiwyg/bootstrap-wysihtml5.css" rel="stylesheet" media="screen">

        <script src="vendors/jquery-1.9.1.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <script src="vendors/jquery.uniform.min.js"></script>
        <script src="vendors/chosen.jquery.min.js"></script>
        <script src="vendors/bootstrap-datepicker.js"></script>

        <script src="vendors/wysiwyg/wysihtml5-0.3.0.js"></script>
        <script src="vendors/wysiwyg/bootstrap-wysihtml5.js"></script>

        <script src="vendors/wizard/jquery.bootstrap.wizard.min.js"></script>

	<script type="text/javascript" src="vendors/jquery-validation/dist/jquery.validate.min.js"></script>
	<script src="assets/form-validation.js"></script>
        
    
	<script src="assets/scripts.js"></script>
         <script>
            var dir_first = $("#dir_first");
            var dir_second = $("#dir_second");
            var dir_third = $("#dir_third");
            var mySetting = $("#mySetting");
             var myBinding = $("#myBinding");
             var myUpdatePwd = $(".section");
             var dir = $("#dir");
             var myImg = $("#myImg");
             var myOrderTable = $("#myOrderTable");
             
             /*myOrderTable.hide();
            myBinding.hide();
             myUpdatePwd.hide();
             dir_second.hide();
             dir_third.text("设置");*/
             GetRequest();  
             orderShow();
        
              /* 显示订单 */
				 $.getJSON(
						"showOrder",
						function(data) {
                            if(data == null) {
                                alert("还没有订单");
                            }
						    comm=data;
                         
							for (var i = 0; i < data.length; i++) {
                                

								var status = null;
                                ordermain.append("<tr><td>" + data[i]['orderId']+"</td><td>"+ 
                                           data[i]['orderTIme']+"</td><td>"+ 
                                           data[i]['receiver']+"</td><td>"+
                                            data[i]['money']+"</td><td>"+
                                            data[i]['commodityId']+"</td><td>"+
                                            data[i]['orderAddress']+"</td></tr>"    
                                );

							}
						});
             
             
             
                            $("#mysubmit").on("click",function(){
                                        alert($("#admin_mail").val());
                                        $("#b").hide();
                                        var mail = null;
                                        var admin={email:$("#admin_mail").val(),password:$("#admin_pwd").val(),
                                              tele:$("#admin_tel").val(),newemail:$("#newadmin_mail").val()};
                                        alert("1");
                                        /*alert(s.attr());*/
                                       /* var admin = {admin_uname : "amdin"};*/
                                        $.ajax("bindingMail",{data:admin,type:"POST",success:function(d){
                                            if(d.email != null) {
                                                $("#a").hide();
                                                $("#b").show();
                                    
                                            }else {
                                                $("#a").hide();
                                                $("#b").hide();
                                                $("#c").hide();
                                                 $("#d").show();
                                            }
                                        },beforeSend:function(XMLHttpRequest){
                                             $("#a").show();
                                             $("#b").hide();
                                           
                                        },error:function() {
                                             $("#c").show();
                                            $("#a").hide();
                                            $("#b").hide();
                                            $("#d").hide();
                                        }
                                    });
                                    
            
                              });
             $("#myUpdate").on("click",function(){
                                                               
                                        $("#bb").hide();
                                        var mail = null;
                                        var p1 = $("#newpassword1");
                                        var p2 = $("#newpassword2");
                                        alert(p1.val());
                                        if(p1.val() != p2.val()) {
                                            $("#dd").show();
                                            return ;
                                        }
                                        var admin={email:$("#email").val(),password:$("#password").val(),newpassword:p1.val()};
                                 
                                        /*alert(s.attr());*/
                                       /* var admin = {admin_uname : "amdin"};*/
                                        $.ajax("updatePasswd",{data:admin,type:"POST",success:function(d){
                                            if(d.storeId != null) {
                                                $("#aa").hide();
                                                $("#bb").show();
                                    
                                            }else {
                                                $("#aa").hide();
                                                $("#bb").hide();
                                                $("#cc").hide();
                                                 $("#dd").show();
                                            }
                                        },beforeSend:function(XMLHttpRequest){
                                             $("#aa").show();
                                             $("#bb").hide();
                                           
                                        },error:function() {
                                             $("#cc").show();
                                            $("#aa").hide();
                                            $("#bb").hide();
                                            $("#dd").hide();
                                        }
                                    });
                                    
            
                              });
       
       
       
    function setting() {
        myBinding.hide();
        mySetting.show();
        myUpdatePwd.hide();
        dir_second.hide();
        dir.show();
        dir_third.text("设置");
        myOrderTable.hide();
    }
             
    function updatePwd() {
        $("#cc").hide();
        $("#aa").hide();
        $("#bb").hide();
        $("#dd").hide();
         myOrderTable.hide();
        mySetting.hide();
        myBinding.hide();
        myUpdatePwd.show();
        dir_second.show();
        dir.show();
        dir_third.show();
        dir_third.text("修改密码");
    }
    function bingding() {
         myOrderTable.hide();
        $("#c").hide();
        $("#a").hide();
        $("#b").hide();
        $("#d").hide();
        mySetting.hide();
        myBinding.show();
        dir_second.show();
        dir.show();
        dir_third.show();
        dir_third.text("修改邮箱");
        
    }    
         
     function orderShow() {
            $("#cc").hide();
            $("#aa").hide();
            $("#bb").hide();
            $("#dd").hide();
         $("#c").hide();
        $("#a").hide();
        $("#b").hide();
        $("#d").hide();
           
            myOrderTable.show();
            mySetting.hide();
        myBinding.hide();
       
        
            dir_second.hide();
            dir_third.text("订单信息");
       
            dir_second.attr("href","javascript:refresh();");
        }
             
     /*打开商家信息目录*/
      function refresh() {
           myOrderTable.hide();
               myImg.show();
              myBinding.hide();
              mySetting.hide();
              myUpdatePwd.hide();
                
               dir.hide();
       }
                    
    // 获取actionCode
    function GetRequest() {
            var url = location.search; 
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                //alert(str);
                var strs= new Array();   
                strs = str.split('=');
                var actionCode=strs[1].trim();
                
                
                if(actionCode == "binding"){
                     bingding();
                }else if(actionCode == "update"){
                    updatePwd();
                }
               
            }
        }
            
    /*定时获得数据*/
             $(function() {
                
                run();
                var interval;
                function run() {
                    interval = setInterval(chat,5000);
                }
                function chat() {
                    $.getJSON("newNumber",function(data){
                    
                        if(data!=0) {
                            
                              alert("有" + data + "条新账单，请刷新页面查看");
                        }
                    })
                }
                
            })
    
	jQuery(document).ready(function() {   
	   FormValidation.init();
	});
	

        $(function() {
            $(".datepicker").datepicker();
            $(".uniform_on").uniform();
            $(".chzn-select").chosen();
            $('.textarea').wysihtml5();

            $('#rootwizard').bootstrapWizard({onTabShow: function(tab, navigation, index) {
                var $total = navigation.find('li').length;
                var $current = index+1;
                var $percent = ($current/$total) * 100;
                $('#rootwizard').find('.bar').css({width:$percent+'%'});
                // If it's the last tab then hide the last button and show the finish instead
                if($current >= $total) {
                    $('#rootwizard').find('.pager .next').hide();
                    $('#rootwizard').find('.pager .finish').show();
                    $('#rootwizard').find('.pager .finish').removeClass('disabled');
                } else {
                    $('#rootwizard').find('.pager .next').show();
                    $('#rootwizard').find('.pager .finish').hide();
                }
            }});
            $('#rootwizard .finish').click(function() {
                alert('Finished!, Starting over!');
                $('#rootwizard').find("a[href*='tab1']").trigger('click');
            });
        });
        </script>
    </body>

</html>